package com.spa.infrastructure.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.spa.application.dto.PageResult;
import com.spa.application.dto.admin.TransferOrderExportDTO;
import com.spa.application.dto.admin.TransferOrderPageDTO;
import com.spa.application.dto.shop.OrderTransferDto;
import com.spa.application.query.admin.TransferOrderPageQuery;
import com.spa.application.query.shop.OrderTransferCountQuery;
import com.spa.domain.entity.OrderTransfer;
import com.spa.infrastructure.enums.dict.order.OrderTransferStatusEnum;
import com.spa.infrastructure.repository.condition.OrderTransferCondition;
import com.spa.infrastructure.repository.po.OrderTransferPO;
import org.mapstruct.*;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 订单转单表(OrderTransfer) 映射结构类
 *
 * @author makejava
 * @since 2024-01-31 11:38:17
 */
@Mapper
@MapperConfig(unmappedTargetPolicy = ReportingPolicy.WARN)
public interface OrderTransferMapperStruct {

	OrderTransferMapperStruct INSTANCE = Mappers.getMapper(OrderTransferMapperStruct.class);

	OrderTransferCondition query2Condition(TransferOrderPageQuery query);

	OrderTransferCondition query2Condition(OrderTransferCountQuery query);

	Page<OrderTransfer> po2Entity4Page(Page<OrderTransferPO> po);
	
	List<OrderTransfer> po2Entity4List(List<OrderTransferPO> po);

	List<OrderTransferDto> entity2Dto4List(List<OrderTransfer> entity);

	Page<OrderTransferDto> entity2Dto4List(Page<OrderTransfer> entity);

	@Mapping(source = "status", target = "status", qualifiedByName = "int2Enum")
	OrderTransferDto entity2Dto(OrderTransfer entity);

	OrderTransfer po2Entity(OrderTransferPO po);

	OrderTransferPO po2Entity(OrderTransfer entity);

	PageResult<TransferOrderPageDTO> entity2TransferOrderPageDTO(Page<OrderTransfer> orderTransferPage);

	List<TransferOrderPageDTO> entity2TransferOrderList(List<OrderTransfer> orderTransferPage);

	@Named("int2Enum")
	default OrderTransferStatusEnum int2Enum(int status) {
		return OrderTransferStatusEnum.byCode(status);
	}


	TransferOrderExportDTO entity2TransferOrderExportDTO(OrderTransfer entity);

	List<TransferOrderExportDTO> entity2TransferOrderExportDTO(List<OrderTransfer> entity);
}
